<template>
	<view class="content">
		<view class="hei20"></view>
		<view class="wid90 mar bacFFF borRad20" style="padding: 20rpx 0;">
			<view class="wid90 mar foSi30">
				<view style="height: 10rpx;"></view>
				<view class="dis disAl disJuB" style="height: 74rpx;">
					<view class="fowe600">原始密码</view>
					<input type="safe-password" style="text-align: right;" v-model="password" placeholder="输入正在使用的密码" />
				</view>
				<view class="xia"></view>
				<view class="dis disAl disJuB" style="height: 74rpx;">
					<view class="fowe600">修改密码</view>
					<input type="safe-password" style="text-align: right;" v-model="xi_password" placeholder="输入新的密码" />
				</view>
			</view>
		</view>
		<view class="wid100 dis disJuC poAbs" style="bottom: 50rpx;">
			<view class="dis disAl disJuC borRad10 foSi40 coFFF" @click="baocun()"
				style="width: 480rpx;height: 84rpx;background-color: #035DFF;">保存</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: this.global.url,
				password: '',
				xi_password: ''
			}
		},
		onLoad() {
		},
		methods: {
			baocun() {
				var that = this;
				if(!that.password){
					return uni.showToast({title: '请输入原始密码',icon: 'none',duration: 1000});
				}else if(!that.xi_password){
					return uni.showToast({title: '请输入新的密码',icon: 'none',duration: 1000});
				}
				var userInfo = uni.getStorageSync('yuan_userinfo')
				uni.request({
					url: that.global.url + '/api/qianyu_petrol/gasstation_clerk_update_password',
					method: "POST",
					header: {
						'site-id': that.global.site_id, //自定义请求头信息
						'token': uni.getStorageSync('token')
					},
					data: {
						'mobile': userInfo.mobile,
						'password': that.password,
						'new_password': that.xi_password
					},
					success(res) {
						let result = res.data
						console.log(result)
						if (result.code == 1) {
							uni.navigateBack()
						}
					}
				})
			}
		}
	}
</script>

<style>
	.content {
		background: #F6F9FE;
		height: 100vh;
	}

	.xia {
		border: 1rpx dashed #E1DFDF;
	}
	button{padding: 0;margin: 0;background-color: #fff;height: 120rpx;}
	button::after{ border: none; }
	.button-hover {
		color:rgba(0, 0, 0, 0.6);
		background-color:#fff;
	}
</style>